package com.axzhengxin.platform.business.controller;

import cn.hutool.core.util.IdUtil;
import com.axzhengxin.platform.afterloan.domain.FspCorInf;
import com.axzhengxin.platform.afterloan.service.IFspCorInfoService;
import com.axzhengxin.platform.business.domain.BizFactoringInfo;
import com.axzhengxin.platform.business.domain.BizInsuranceInfo;
import com.axzhengxin.platform.business.service.IBizFactoringInfoService;
import com.axzhengxin.platform.business.service.IBizInsuranceInfoService;
import com.axzhengxin.platform.common.service.IDbExecService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * @author AHZJ0005
 */
@Slf4j
@RestController
@RequestMapping("/biz/insurance")
public class BizInsuranceInfoController extends BaseController {

    @Autowired
    private IBizInsuranceInfoService bizInsuranceInfoService;
    @Autowired
    private IFspCorInfoService fspCorInfoService;
    @Autowired
    private IDbExecService dbExecService;




    @RequestMapping("/list")
    public TableDataInfo list(BizInsuranceInfo bizInsuranceInfo) {
        startPage();
        return getDataTable(bizInsuranceInfoService.selectBizInsuranceInfoList(bizInsuranceInfo));
    }


    @RequestMapping("/detail")
    public BizInsuranceInfo detail(String insuranceId) {
        BizInsuranceInfo bizInsuranceInfo = bizInsuranceInfoService.selectBizInsuranceInfoById(insuranceId);
        String customerId = bizInsuranceInfo.getCustomerId();
        String customerName = bizInsuranceInfo.getCustomerName();
        FspCorInf fspCorInf = bizInsuranceInfoService.getFspCorInf(customerId, customerName);
        bizInsuranceInfo.setFspCorInf(fspCorInf);
        return bizInsuranceInfo;
    }


}
